(function (doc, win) {
    //防抖函数
    function debounce(handler, interval) {
        var timer = null;
        handler(); //首次执行
        return function () {
            if (timer != null) clearTimeout(timer);
            timer = setTimeout(handler, interval);
        };
    }
    //具体的处理函数
    function handler() {
        var clientW = window.innerWidth; //获取当前窗口的宽度
        clientW = clientW >= 1910 ? 1920 : clientW; //限制最大的宽度
        var fz = (clientW / 375) * 100;
        var view_width = document.getElementsByTagName("html")[0].getBoundingClientRect().width;
        document.documentElement.style.fontSize = fz + "px";

        var _html = document.getElementsByTagName("html")[0];
        view_width = view_width > 1910 ? 1910 / 37.5 : view_width / 37.5;
        var sw = view_width / 3.75;
        var lw = (fz + sw) / 5;
        document.documentElement.style.fontSize = lw + "px";
        _html.style.fontSize = lw + "px";

        var docEl = doc.documentElement;
        var clientWidth = docEl.clientWidth;
        if (!clientWidth) return;
        if (clientWidth > 1910) clientWidth = 1920; //这里限制最大的宽度尺寸，从而实现PC端的两边留白等
        docEl.style.fontSize = (clientWidth / 37.5) + "px";
        // alert(122)
    }
    if (!doc.addEventListener) return;





    //监听窗口的缩放事件1
    window.addEventListener(supportsOrientationChange, debounce(handler, 300));
    doc.addEventListener("DOMContentLoaded", debounce(handler, 300), false);
    var supportsOrientationChange = "onorientationchange" in window ? "orientationchange" : "resize";


})(document, window);
